package com.hlbb.app;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.hlbb.business.AccountManager;
import com.hlbb.domain.bean.Camaster;
import com.hlbb.domain.bean.CamasterId;

public class LoadData {

	public static void main(String[] args) {
		System.out.println("Program is starting...");
		try {
			// Initial application context
			System.out.println(" spring context is loading...");
			AppContext.setSpringContext(new ClassPathXmlApplicationContext(
					"spring-datasource-config.xml"));
			System.out.println(" spring context is loaded!");

			AccountManager accountManager = (AccountManager)AppContext.getSpringContext()
												.getBean("accountManager");
			
			//Insert Camaster
			
			// Prepare Id for Camaster
			CamasterId id = new CamasterId();
			id.setAccountnumber("123456789");
			id.setCurrentstatementdate(9);
			
			// Prepare object for Camaster
			Camaster camaster = new Camaster();
			camaster.setId(id);
			
			accountManager.addCamaster(camaster);
			

		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("Done!");
	}

}
